package org.datedemo;

import java.time.LocalDate;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;

public class DateEx1 {
    public static void main(String[] args) {
        //String字符串对象，本质是char[] 字符数组
        String str = "鸡狗猪鼠牛虎兔龙蛇马羊";
        int year = 2000;
        char c = str.charAt(year % 12);
        System.out.println(c);

        System.out.println("猴鸡狗猪鼠牛虎兔龙蛇马羊".charAt(year%12));

        //设置本地化程序环境
        //Locale.setDefault(Locale.US);
        System.out.printf("%tA %<tp%n",System.currentTimeMillis());

        //0-6
        System.out.println("星期"+"日一二三四五六".charAt(new Date().getDay()));

        //1-7  0-6
        System.out.println("星期"+"日一二三四五六".charAt(Calendar.getInstance().get(Calendar.DAY_OF_WEEK)-1));


        Calendar c2 = Calendar.getInstance();
        c2.set(2023,1-1,1);
        System.out.printf("%tF %<ta %<tA%n",c2);

    }
}
